void rotate(int* nums, int numsSize, int k) {
    k = k % numsSize;
    int tmp=0;
    for(int i=0,j=numsSize-1;i<numsSize/2;++i,--j)
    {
        tmp=nums[i];
        nums[i]=nums[j];
        nums[j]=tmp;
    }
    for(int i=0,j=k-1;i<j;++i,--j)
    {
        tmp=nums[i];
        nums[i]=nums[j];
        nums[j]=tmp;
    }
    for(int i=k,j=numsSize-1;i<j;++i,--j)
    {
        tmp=nums[i];
        nums[i]=nums[j];
        nums[j]=tmp;
    } 
}
